/*  Andrew Shore
	CSCE 145
	Homework 5
	*/
public class Pet{	
	private int happy;
	private int hungry;
	private String name;
	private String species;
	private boolean alive;
	
	//default constructor
	Pet(){
		happy=15;
		hungry=15;
		name="Unknown";
		alive=true;
	}
	
	//accessors
	public int getHappy(){
		return happy;
	}
	public int getHungry(){
		return hungry;
	}
	public String getName(){
		return name;
	}
	public String getSpecies(){
		return species;
	}
	public boolean getAlive(){
		return alive;
	}
	
	
	//mutators
	public void setHappy(int newHappy){
		happy=newHappy;
	}
	public void setHungry(int newHungry){
		hungry=newHungry;
	}
	public void setName(String newName){
		name=newName;
	}
	public void setSpecies(String newSpecies){
		species=newSpecies;
	}
	public void setAlive(boolean newAlive){
		alive=newAlive;
	}
	
	//member functions
	
	public void printOptions(){
		System.out.println("*************************************");
		System.out.println("* Enter 'Feed' to feed Pete         *");
		System.out.println("* Enter 'Play' to play with Pete    *");
		System.out.println("* Enter 'Quit' to exit this program *");
		System.out.println("*************************************");
	}
	
	/*feeds pet if its happy enough, I decided to make the pet less happy when you feed it and more hungry when you 
	play with it to make it more like a game*/
	public void feedPet(){
		if(happy>7&&alive){
			hungry=hungry-7;				//takes away 7 hungry points
			happy=happy-2;					//takes away 2 happiness points
			System.out.println(name+" is being fed");
		}
		if(happy<7&&alive){
			System.out.println("Your pet is too unhappy to feed");
		}
		if(!alive){
			System.out.println(name+" is no longer alive. You weren't a very good caretaker.");
		}
	}
	
	public void playWithPet(){
		if(hungry<=12&&alive){
			System.out.println("You play with "+ name);
			happy=happy+6;					//adds 6 happiness points
			hungry=hungry+2;				//adds 2 points to hunger
		}
		if(hungry>12&&alive){
			System.out.println(name+" is too hungry to play. Feed him first.");
		}
		if(!alive){
			System.out.println(name+" is dead. You weren't a very good caretaker.");
		}
	}
	
		
	//assigns hunger status to a string and returns it to be used in caretaker program
		public String printHungry(){
			if(hungry>12){
				String isHungry="hungry";
				return isHungry;
			}
			else {
				String notHungry="full";
				return notHungry;
			}
		}
	
	//determines if pet is happy or unhappy
		public String printHappy() {
			if(happy>12){
				String isHappy="happy";
				return isHappy;
			}
			else{
				String notHappy="unhappy";
				return notHappy;
			}
			
			}
		
		//determines if pet is alive then returns a string that says its alive or dead
		public String testAlive(){
			if(happy<10 && hungry>20){
				alive=false;
				String dead="dead";
				return dead;
			}
			else{
				alive=true;
				String alive="alive";
				return alive;
		
			}
		}
		
}
